Carbon


SetDebuggerNotificationProcs

Header: Threads.h Carbon status: Supported

Installs functions that notify the debugger when a thread is created, disposed of, or scheduled.

OSErr SetDebuggerNotificationProcs (
    DebuggerNewThreadUPP notifyNewThread, 
    DebuggerDisposeThreadUPP notifyDisposeThread, 
    DebuggerThreadSchedulerUPP notifyThreadScheduler
);
notifyNewThread

A pointer to the callback function that notifies the debugger when a thread is created.

notifyDisposeThread

A pointer to the callback function that notifies the debugger when a thread is disposed of. This function is called whether you manually dispose of a thread with the DisposeThread function or if a thread disposes of itself automatically when it returns from its highest level of code.

notifyThreadScheduler

A pointer to the callback function that notifies the debugger when a thread is scheduled.

function result

A result code.

DISCUSSION

You generally use this function only during development of an application.

The SetDebuggerNotificationProcs function installs three separate callback functions that return the thread ID of a newly created thread, the thread ID of a newly disposed of thread, and the thread ID of a newly scheduled thread.

The SetDebuggerNotificationProcs function always installs all three of the debugging functions. You cannot set only one or two of these functions, nor can you chain them together. These restrictions ensure that the function that calls SetDebuggerNotificationProcs owns all three of the debugging functions. If you want to prevent one or two of these debugging functions from being called, you can do so by setting them to NULL.

To guarantee that the debugger is getting an accurate view of scheduling, the Thread Manager doesnít call the scheduling-notification callback function until both the generic Thread Manager scheduler and any custom thread scheduler have decided on a thread to schedule.

Do not pass a function descriptor as any of the parameters to the SetDebuggerNotificationProcs function. As with all Thread Manager functions that pass a function pointer, you must pass the address of the function, not the address of a function descriptor. You are required to use function descriptors when you write code in the PowerPC instruction set that passes a functionís address to code that might be in the 680x0 instruction set. However, the threads in your application must all be in the same instruction setó680x0 or PowerPC. Therefore, the functions identified by the parameters in this function are by definition in the same instruction set as the SetDebuggerNotificationProcs function and a function descriptor is not required.

To create or allocate a new thread, use the NewThread function.

To dispose of a thread, use the DisposeThread function.

To schedule a thread, you can use a yield function such as YieldToAnyThread or YieldToThread or a function to change the state of a thread, such as SetThreadState.

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when ThreadsLib 1.0 or later is installed. Exported by CarbonLib 1.0 and later and by ThreadsLib 1.0 and later.


© 2000 Apple Computer, Inc. — (Last Updated 3/8/2000)